<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="号码1" prop="nums1">
        <el-input type="textarea" rows="18" v-model="nums1"></el-input>
      </el-form-item>
      <el-form-item label="号码2" prop="nums2">
        <el-input type="textarea" rows="18" v-model="nums2"></el-input>
      </el-form-item>
      <el-form-item label="号码3" prop="nums3">
        <el-input type="textarea" rows="18" v-model="nums3"></el-input>
      </el-form-item>
      <el-form-item label="号码4" prop="nums4">
        <el-input type="textarea" rows="18" v-model="nums4"></el-input>
      </el-form-item>
      <el-form-item label="号码5" prop="nums5">
        <el-input type="textarea" rows="18" v-model="nums5"></el-input>
      </el-form-item>
      <el-form-item label="号码6" prop="nums6">
        <el-input type="textarea" rows="18" v-model="nums6"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="calNums(1)">交集</el-button>
        <el-button type="primary" icon="el-icon-printer" size="mini" @click="calNums(2)">并集</el-button>
        <el-button type="primary" icon="el-icon-printer" size="mini" @click="calNums(3)">反集</el-button>
      </el-form-item>
    </el-form>
    <el-form :model="queryParams" ref="queryForm" size="small" label-width="68px">
      <el-form-item label="结果" prop="nums1">
        <el-input type="textarea" rows="10" v-model="result" readonly></el-input>
      </el-form-item>
      <el-form-item label="号码个数" prop="size">
        <el-input v-model="size" readonly></el-input>
      </el-form-item>
      <el-form-item label="投入">
        <el-input v-model="tr" readonly></el-input>
      </el-form-item>
      <el-form-item label="盈利">
        <el-input v-model="yl" readonly></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import {calNums} from "@/api/caipiao/calpl5";

export default {
  name: "Cal",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 排列5方法2预测表格数据
      twoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      nums1: '',
      nums2: '',
      nums3: '',
      nums4: '',
      nums5: '',
      nums6: '',
      result: '',
      size: 0,
      tr: 0,
      yl: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        qs: null,
        position1: null,
        position2: null,
        position3: null,
        position4: null,
        position5: null,
        rightPl5: null,
        rightPl3: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        qs: [
          {required: true, message: "期数不能为空", trigger: "blur"}
        ],
        createTime: [
          {required: true, message: "创建时间不能为空", trigger: "blur"}
        ],
        rightPl5: [
          {required: true, message: "是否正确(0未兑奖  1正确 2不正确)不能为空", trigger: "blur"}
        ],
        rightPl3: [
          {required: true, message: "是否正确(0未兑奖  1正确 2不正确)不能为空", trigger: "blur"}
        ]
      }
    };
  },
  created() {
  },
  methods: {
    /** 生成号码 */
    calNums(ty) {
      this.loading = true;
      let arr = []
      arr.push(this.nums1)
      arr.push(this.nums2)
      arr.push(this.nums3)
      arr.push(this.nums4)
      arr.push(this.nums5)
      arr.push(this.nums6)
      calNums(arr, ty).then(response => {
        this.result = response.msg;
        this.size = response.size;
        this.tr = 2 * response.size;
        this.yl = 1040 - this.tr;
      });
    }
  }
};
</script>
